package com.project.controller;


import com.project.bean.ConsultBean;
import com.project.bean.EventBean;
import com.project.service.ConsultService;
import com.project.service.EventService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("consult")
public class ConsultController {

    @Resource
    private ConsultService consultService;

    @Resource
    private EventService eventService;


    //显示所有会商信息
    @RequestMapping("findAllConsult")
    @ResponseBody
    public List<EventBean> findAllConsult(){
        System.out.println(eventService.findAllConsult());
        return eventService.findAllConsult();
//        return consultService.findAllConsult();
    }


    //添加会商
    @RequestMapping("addConsult")
    @ResponseBody
    public String addConsult(@RequestParam(value = "eventId", defaultValue = "")int eventId,
                             ConsultBean consultBean){
        consultService.addConsult(eventId,consultBean);
        return "ok";
    }
}
